<table class="table table-border table-bordered table-hover table-bg">
	<thead>
		<tr class="text-c">
			<th>编号</td>
			<th>房间号</td>
			<th>合同号</td>
			<th>用户名</td>
			<th>押金</td>
			<th>管理员</td>
			<th>出售时间</td>
			<th>操作</td>
		</tr>
	</thead>
	<tbody>
		<?php if($list){ foreach($list as $k=>$ls){ ?>
		<tr class="text-c">
			<td><?php echo ($page-1)*C('PAGE_SIZE')+($k+1); ?></td>
			<td>{$ls['roomnumber']}</td>
			<td>{$ls['contract']}</td>
			<td>{$ls['nickname']}</td>
			<td>{$ls['card_deposit']}</td>
			<td>{$ls['admin_nick']}</td>
			<td>
				<?php echo date('Y-m-d H:i:s', $ls['createtime']); ?>
			</td>
			<td>
				<?php if(!$ls['is_back']){ ?>
				<button type="button" class="btn btn-danger radius submitBtn" ids="{$ls['id']}">
					<i class="icon-ok"></i> 退卡
				</button>
				<?php } ?>
			</td>
		</tr>
		<?php } }else{ ?>
		<tr class="text-c">
			<td colspan="14">暂无数据...</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<!--page-->
<include file="Common/page" />
<script>
	$(document).ready(function(){
		$(".btn-danger").on('click', function(){
			var ids = $(this).attr('ids');
			layer.open({
			  	title: '退卡备注',
			  	content: '<input type="text" class="input-text radius" id="remark" name="remark" value="" />',
			  	yes: function(){
			  		var remark = $("#remark").val() || "";
			  		if(remark.length){
			  			$.post('sell.html', {ids: ids, remark: remark}, function(row){
							if(row/1){
								layer.msg('退卡成功', {icon: 1, time: 2000}, function(){
									location.reload();
								});
							}else{
								layer.msg('退卡失败', {icon: 2, time: 2000});
							}
						});
			  		}else{
			  			layer.msg('请输入退卡备注', {icon: 5, time: 2000});
			  		}
			  	}
			});
		});
	});
</script>